1 Wisent Overview
Wisent (the European Bison) is an implementation in
Emacs Lisp of the GNU Compiler Compiler Bison. Its code is a port
of the C code of GNU Bison 1.28 & 1.31.
For more details on the basic concepts for understanding
Wisent, it is worthwhile to read the
(bison)Bison Manual.
Wisent can generate compilers compatible with the
Semantic tool set. See the
(semantic)Semantic Manual.
It benefits from these Bison features:
- It uses a fast but not so space-efficient encoding for the
parse tables, described in Corbett’s PhD thesis from
Berkeley:
Static Semantics in Compiler Error
Recovery
June 1985, Report No. UCB/CSD 85/251.
- For generating the lookahead sets, Wisent uses the
well-known technique of F. DeRemer and T. Pennello described
in:
Efficient Computation of LALR(1) Look-Ahead
Sets
October 1982, ACM TOPLAS Vol 4 No 4, 615–49, http://dx.doi.org/10.1145/69622.357187.
- Wisent resolves shift/reduce conflicts using operator
precedence and associativity.
- Parser error recovery is accomplished using rules which
match the special token
error.
Nevertheless there are some fundamental differences between
Bison and Wisent.
- Wisent is intended to be used in Emacs. It reads and
produces Emacs Lisp data structures. All the additional code
used in grammars is Emacs Lisp code.
- Contrary to Bison, Wisent does not generate a parser which
combines Emacs Lisp code and grammar constructs. They exist
separately. Wisent reads the grammar from a Lisp data structure
and then generates grammar constructs as tables. Afterward, the
derived tables can be included and byte-compiled in separate
Emacs Lisp files, and be used at a later time by the
Wisent’s parser engine.
- Wisent allows multiple start nonterminals and allows a call
to the parsing function to be made for a particular start
nonterminal. For example, this is particularly useful to parse
a region of an Emacs buffer. Semantic heavily depends on
the availability of this feature.